<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script>
  // 배열 리터럴
	var empty=[];
	var primes=[2,3,5,7,11];
	var misc=[1.1,true,"a"];

	var base =1024;
	var table=[base,base+1,base+2,base+3];
	var b=[[1,{x:1,y:2}],[2,{x:3,y:4}]];
	alert(b[0][1].x);

	var count=[1,,3]; //원소 3개중  2번째는 정의 되지 않음.
	var undef=[,,];  //정의 되지 않은  3개의 원소

	//alert(undef.length);  ->3

	// Array()생성자 이용
	var a= new Array();
	var b= new Array(5,4,3,2,1,"string1","string2",{x:1,y:2});
	alert(b[7].x);
	var c= new Array(10);  //-> 10개의  배열 원소를 생성

	var test=[0,1];
	if(test[0])
		alert(test[0]);
//========================================array function====================================
	document.write(b.join("/")+"<br>");

	var aaa=[33,4,1111,222];
	aaa.sort();
	document.write(aaa.join());

	aaa.sort(function(a,b){
		return a-b;
	});
	write(aaa.join());
	
	write(aaa.concat([1,2]));
	write(aaa.concat(1,2));
	
	var num=[1,2,3,4,5,6,7,8];
	write(num.slice(1,7));
	
	var spliceArr = num.splice(1,3);
	
	write(num.join());
	write(spliceArr.join());
	
	var num2=[1,2,3,4,5,6,7,8];
	num2.splice(2,0,'a','b')
	write(num2.join());
	
	function write(a){
		document.write("<br>"+a);
	}
  </script>
</head>
<body>

</body>
</html>